var productId;
window.onload = function (){
    productId = getQuery("id");
        findAll(1)
}
function findAll(pageNo){
    axios.get("/in/findAll",{
        params:{
            pageNo,
            id:productId,
            name:$("nameTxt").value,
            author:$("authorTxt").value,
            startDate:$("startDate").value,
             endDate:$("endDate").value,
        }   }).then(resp=>{
      var info=  resp.data
        console.log(info)
        var str=""
        info.list.forEach(n=>{
            str+=`<tr><td><span onclick=location.href='/comment.html?id=${n.id}'>${n.name}</span></td><td>${n.user.name}</td><td>${n.replyNum}</td><td>${n.date}</td></tr>`
            })
        $("tb").innerHTML=str;
        var pageStr="";
        for (var i=1;i<=info.totalPage;i++){
            pageStr+=`<a href="javascript:findAll(${i})" style="margin-left: 10px">${i} </a>`
        }
        $("cutDiv").innerHTML=pageStr;
    })
}
function publish(){
    location.href="/speak.html?id="+productId;
}
